/**
 * @Title:RoleService.java
 * @Package:com.xpjhs.role.service
 * @Description:TODO
 * @author:luckyboyguo@126.com
 * @date:2015年1月16日{time}
 * @version:v1.0
 */
package com.xpjhs.role.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.xpjhs.role.dao.RoleDao;
import com.xpjhs.role.model.Role;

/**
 * @ClassName:RoleService
 * @Description:{todo
 * @author luckyboyguo@126.com
 * @date:2015年1月16日下午1:42:12
 */
@Service
@Transactional(readOnly = true)
public class RoleService {
	@Autowired
	private RoleDao roleDao;

	public void saveRole(Role role) {
		roleDao.save(role);
	}

	public void deleteRole(Role role) {
		roleDao.delete(role);
	}

	public void deleteRoleById(long id) {
		roleDao.delete(id);
	}

	public List<Role> listAllRoles() {
		return roleDao.findAll();
	}

	public Role findRoleById(long id) {
		return roleDao.findOne(id);
	}

	public Page<Role> listRolesByPage(Pageable pageable) {
		return roleDao.findAll(pageable);
	}
}
